Ext.onReady(function() {
	var toolbar = Ext.create('Ext.toolbar.Toolbar', {
		dock : 'top',
		items : [{
			text : '返回',
			xtype : 'button',
			listeners:{
				click: function(){
					location.href="/sysMgr/political_status_mgr";
				}
			}
		},{
			text : '保存',
			xtype : 'button',
			listeners:{
				click: function(){
					var form = Ext.getCmp("political_status_form");
					if(!form.isValid()){
						return;
					}
					Ext.Ajax.request({
						url: '/political_status/update',
						type: 'POST',
						params:{
							Id: politicalStatus.Id,
							Name: Ext.getCmp("political_status_name").getValue()
						},
						callback: function(options, success, response){
							if(success){
								var result = Ext.decode(response.responseText);
								if(result.success){
									location.href="/sysMgr/political_status_mgr";
								}
								else{
									Ext.Msg.alert('错误',  result.msg);
								}
							}
						}
					})
				}
			}
		}]
	});
	
	var detailPanel = Ext.create("Ext.form.Panel",{
		id: "political_status_form",
		border: false,
		autoScroll:true,
		margin: '5 5',
		items: [{
			xtype: 'container',
			layout: 'hbox',
			margin: '5 0',
			items: [{
				xtype: 'textfield',
				id: "political_status_name",
        		fieldLabel: '名称',
        		value: politicalStatus.Name,
        		allowBlank: false
			}]
		}]
	});
	
	var panel = Ext.create("Ext.panel.Panel", {
		title: '',
		border : false,
		bodyBorder : false,
		autoScroll:true,
		layout : 'fit',
		dockedItems : [ toolbar ],
		items : [detailPanel]
	});
	Ext.create('Ext.Viewport', {
		layout : 'fit',
		style : 'background:none;background-color:white;',
		items : [ panel ]
	});
});